package com.android.questions.util;

import android.content.Context;

import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;

/**
 * FileName: Command
 * Author: admin
 * Date: 2021/11/4 15:15
 * Description:
 */
public class Command {

    public static final String NETWORK_ERROR = "网络出现异常";
    public static final String INTERFACE_ERROR = "接口出现异常";
    public static final String NO_DATA = "暂无数据";
    public static final String SHARE_ERROR = "分享失败";
    public static final String DOWNLOAD_SECCESS_IMAGE_GALLERY = "下载成功，请到图库查看";
    public static final String DQ_ANSWER_TEST_DATA = "D1RG5YH5A5E";

    public static class Method {

        public static LinearLayoutManager getLinearLayoutManager(Context c) {
            return new LinearLayoutManager(c);
        }

        public static LinearLayoutManager getLinearLayoutManager(Context c, boolean isScroll) {
            return new LinearLayoutManager(c) {
                @Override
                public boolean canScrollVertically() {
                    return isScroll;
                }

                @Override
                public boolean canScrollHorizontally() {
                    return isScroll;
                }
            };
        }

        public static GridLayoutManager getGridLayoutManager(Context c, int spanCount) {
            return new GridLayoutManager(c, spanCount);
        }

        public static GridLayoutManager getGridLayoutManager(Context c, int spanCount, boolean isScroll) {
            return new GridLayoutManager(c, spanCount) {
                @Override
                public boolean canScrollHorizontally() {
                    return isScroll;
                }

                @Override
                public boolean canScrollVertically() {
                    return isScroll;
                }
            };
        }
    }
}